package liangtWorkSpace.springAll.times;

import liangtWorkSpace.springAll.times.impl.ExBeans;
import liangtWorkSpace.springAll.times.impl.HelloWorldImpl;
import liangtWorkSpace.springAll.times.impl.ToBeans;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author liangt
 * @ClassName: TimesTest
 * @title: TimesTest
 * @projectName liangtWorkSpace.springAll.times
 * @description: TODO
 * @date 2020/10/15 16:35
 */
public class TimesTest {

    public static void main(String[] args) {
        String xmlPath = "times/Beans.xml";
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext(xmlPath);
        //演示创建前调用
        ExBeans exBeans = (ExBeans) applicationContext.getBean("exBean");
        exBeans.getMessage();
        //演示销毁时调用
        ToBeans toBeans = (ToBeans) applicationContext.getBean("toBean");
        toBeans.getMessage();
        //演示创建和销毁时调用
        HelloWorldImpl helloWorld = (HelloWorldImpl) applicationContext.getBean("helloWorld");
        helloWorld.getMessage();

    }
}
